//
//  UIApplication+AppInfo.h
//  lc-collect
//
//  Created by mac on 2021/3/4.
//

#import <UIKit/UIKit.h>
#import <UIKit/UIKit.h>
#import <CoreLocation/CoreLocation.h>
#import "AddressBook/ABAddressBook.h"
#import "EventKit/EventKit.h"
#import "AVFoundation/AVFoundation.h"
#import "AssetsLibrary/AssetsLibrary.h"

NS_ASSUME_NONNULL_BEGIN

typedef void(^grantBlock)(BOOL granted);

@interface UIApplication (AppInfo)

@property (strong, nonatomic) UIWindow *window;


///-------------------------------------
/// @name  app基本信息
///-------------------------------------

/// 当前app名称
- (NSString *)appName;

/// 当前app版本号
- (NSString *)appVersion;

///  build 版本号
- (NSString *)appBuild;

/// apps 证书编号 (例如MacKun.az.com)
- (NSString *)appBundleID;

///--------------------------------------------------------------
/// @name  沙盒缓存大小
///--------------------------------------------------------------

/// 沙盒的路径
- (NSString *)documentsDirectoryPath;

/// 沙盒的内容大小 (例如5 MB)
- (NSString *)documentsFolderSizeAsString;

/// 沙盒内的字节大小
- (int)documentsFolderSizeInBytes;

/// 程序的大小 包括文件 缓冲 以及 下载
- (NSString *)applicationSize;


/////---------------------------------------------------------------
///// @name  app 隐私权限
/////---------------------------------------------------------------

/// 定位权限是否开启
- (BOOL)applicationHasAccessToLocationData;

/// 通讯录访问权限是否开启
- (BOOL)applicationhasAccessToAddressBook;

/// 相机权限是否开启
- (BOOL)applicationHasAccessToCalendar;

/// 推送功能是否开启
- (BOOL)applicationHasAccessToReminders;

/// 相册权限是否开启
- (BOOL)applicationHasAccessToPhotosLibrary;

/// 麦克风开启
/// @param flag flag description
- (void)applicationHasAccessToMicrophone:(grantBlock)flag;

///-------------------------------------
/// @name  app 相关事件
///-------------------------------------

/// 注册推送(兼容iOS8)
- (void)registerNotifications;

/// 获取当前视图
- (UIViewController *)getCurrentViewConttoller;


@end

NS_ASSUME_NONNULL_END
